home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / t_unix / j109lxa4.tar / config.c < prev    next >
C/C++ Source or Header  |  1994-06-04  |  30KB  |  1,197 lines

  1. /* A collection of stuff heavily dependent on the configuration info
  2.  * in config.h. The idea is that configuration-dependent tables should
  3.  * be located here to avoid having to pepper lots of .c files with #ifdefs,
  4.  * requiring them to include config.h and be recompiled each time config.h
  5.  * is modified.
  6.  *
  7.  * Copyright 1991 Phil Karn, KA9Q
  8.  */
  9.  /* Mods by PA0GRI */
  10.  
  11. #include <stdio.h>
  12. #ifdef MSDOS
  13. #include <dos.h>
  14. #include <conio.h>
  15. #endif
  16. #include "global.h"
  17. #include "config.h"
  18. #include "mbuf.h"
  19. #include "timer.h"
  20. #include "proc.h"
  21. #include "iface.h"
  22. #include "ip.h"
  23. #include "tcp.h"
  24. #include "udp.h"
  25. #ifdef  ARCNET
  26. #include "arcnet.h"
  27. #endif
  28. #include "lapb.h"
  29. #include "ax25.h"
  30. #ifdef ETHER
  31. #include "enet.h"
  32. #endif
  33. #include "kiss.h"
  34. #include "netrom.h"
  35. #include "nr4.h"
  36. #include "pktdrvr.h"
  37. #include "ppp.h"
  38. #include "slip.h"
  39. #include "arp.h"
  40. #include "icmp.h"
  41. #include "hardware.h"   /***/
  42. #include "usock.h"
  43. #include "cmdparse.h"
  44. #include "commands.h"
  45. #include "mailbox.h"
  46. #include "mailcli.h"
  47. #include "ax25mail.h"
  48. #include "nr4mail.h"
  49. #include "tipmail.h"
  50. #include "bootp.h"
  51. #include "daemon.h"
  52. #include "slhc.h"
  53. #include "rspf.h"
  54. #include "main.h"
  55.  
  56. static int dostart __ARGS((int argc,char *argv[],void *p));
  57. static int dostop __ARGS((int argc,char *argv[],void *p));
  58. static void network __ARGS((int,void *,void *));
  59.  
  60. #ifdef  NNTPS
  61. extern int donntpcli __ARGS((int argc,char *argv[],void *p));
  62. extern int nntp0 __ARGS((int argc,char *argv[],void *p));
  63. extern int nntp1 __ARGS((int argc,char *argv[],void *p));
  64. #endif
  65.  
  66. #ifdef  AX25
  67. static void axip __ARGS((struct iface *iface,struct ax25_cb *axp,char *src,
  68.     char *dest,struct mbuf *bp,int mcast));
  69. static void axarp __ARGS((struct iface *iface,struct ax25_cb *axp,char *src,
  70.     char *dest,struct mbuf *bp,int mcast));
  71. #ifdef RARP
  72. static void axrarp __ARGS((struct iface *iface,struct ax25_cb *axp,char *src,
  73.     char *dest,struct mbuf *bp,int mcast));
  74. #endif
  75. static void axnr __ARGS((struct iface *iface,struct ax25_cb *axp,char *src,
  76.     char *dest,struct mbuf *bp,int mcast));
  77. #endif
  78.  
  79. struct mbuf *Hopper;
  80. unsigned Nsessions = NSESSIONS;
  81.  
  82. #ifndef UNIX
  83. /* Free memory threshold, below which things start to happen to conserve
  84.  * memory, like garbage collection, source quenching and refusing connects
  85.  */
  86. int32 Memthresh = MTHRESH;
  87.  
  88. int Nibufs = NIBUFS;            /* Number of interrupt buffers */
  89. unsigned Ibufsize = IBUFSIZE;   /* Size of each interrupt buffer */
  90. #endif
  91.  
  92. /* Transport protocols atop IP */
  93. struct iplink Iplink[] = {
  94.     TCP_PTCL,       tcp_input,
  95.     UDP_PTCL,       udp_input,
  96.     ICMP_PTCL,      icmp_input,
  97. #ifdef ENCAP
  98.     IP_PTCL,    ipip_recv,
  99. #endif
  100. #ifdef  AXIP
  101.     AX25_PTCL,      axip_input,
  102. #endif
  103. #ifdef  RSPF
  104.     RSPF_PTCL,      rspf_input,
  105. #endif  /* RSPF */
  106.     0,              0
  107. };
  108.  
  109. /* Transport protocols atop ICMP */
  110. struct icmplink Icmplink[] = {
  111.     TCP_PTCL,       tcp_icmp,
  112.     0,              0
  113. };
  114.  
  115. /* ARP protocol linkages */
  116. struct arp_type Arp_type[NHWTYPES] = {
  117. #ifdef  NETROM
  118.     AXALEN, 0, 0, 0, 0, NULLCHAR, pax25, setcall,   /* ARP_NETROM */
  119. #else
  120.     0, 0, 0, 0, 0, NULLCHAR,NULL,NULL,
  121. #endif
  122.  
  123. #ifdef  ETHER
  124.     EADDR_LEN,IP_TYPE,ARP_TYPE,REVARP_TYPE,1,Ether_bdcst,pether,gether, /* ARP_ETHER */
  125. #else
  126.     0, 0, 0, 0, 0, NULLCHAR,NULL,NULL,
  127. #endif
  128.  
  129.     0, 0, 0, 0, 0, NULLCHAR,NULL,NULL,              /* ARP_EETHER */
  130.  
  131. #ifdef  AX25
  132.     AXALEN, PID_IP, PID_ARP, PID_RARP, 10, Ax25multi[0], pax25, setcall,
  133. #else
  134.     0, 0, 0, 0, 0, NULLCHAR,NULL,NULL,              /* ARP_AX25 */
  135. #endif
  136.  
  137.     0, 0, 0, 0, 0, NULLCHAR,NULL,NULL,              /* ARP_PRONET */
  138.  
  139.     0, 0, 0, 0, 0, NULLCHAR,NULL,NULL,              /* ARP_CHAOS */
  140.  
  141.     0, 0, 0, 0, 0, NULLCHAR,NULL,NULL,              /* ARP_IEEE802 */
  142.  
  143. #ifdef  ARCNET
  144.     AADDR_LEN, ARC_IP, ARC_ARP, 0, 1, ARC_bdcst, parc, garc, /* ARP_ARCNET */
  145. #else
  146.     0, 0, 0, 0, 0, NULLCHAR,NULL,NULL,
  147. #endif
  148.  
  149.     0, 0, 0, 0, 0, NULLCHAR,NULL,NULL,              /* ARP_APPLETALK */
  150. };
  151.  
  152. #ifdef  AX25
  153. /* Linkage to network protocols atop ax25 */
  154. struct axlink Axlink[] = {
  155.     PID_IP,         axip,
  156.     PID_ARP,        axarp,
  157. #ifdef RARP
  158.     PID_RARP,   axrarp,
  159. #endif
  160. #ifdef  NETROM
  161.     PID_NETROM,     axnr,
  162. #endif
  163.     PID_NO_L3,      axnl3,
  164.     0,              NULL,
  165. };
  166. #endif
  167.  
  168. #ifdef  MAILCLIENT
  169. struct daemon Mailreaders[] = {
  170. #ifdef  POP2CLIENT
  171.     "POP2",         2048,   pop2_job,
  172. #endif
  173. #ifdef  POP3CLIENT
  174.     "POP3",         2048,   pop3_job,
  175. #endif
  176.     NULLCHAR
  177. };
  178. #endif
  179.  
  180. #ifndef BOOTP
  181. int WantBootp = 0;
  182.  
  183. int
  184. bootp_validPacket(ip,bpp)
  185. struct ip *ip;
  186. struct mbuf **bpp;
  187. {
  188.     return 0;
  189. }
  190. #endif
  191.  
  192. #ifdef  MAILBOX
  193. void (*Listusers) __ARGS((int s)) = listusers;
  194. #else
  195. void (*Listusers) __ARGS((int s)) = NULL;
  196. #endif
  197.  
  198. /* daemons to be run at startup time */
  199. struct daemon Daemons[] = {
  200.     "killer",       1024,   killer,
  201.     "timer",        2048,   timerproc,
  202.     "network",      4096,   network,
  203.     "keyboard",     256,    keyboard,
  204. #ifndef UNIX
  205.     "gcollect",     256,    gcollect,
  206. #endif
  207.     NULLCHAR,       0,      NULLVFP((int, void *, void *))
  208. };
  209.  
  210. struct iftype Iftypes[] = {
  211.     /* This entry must be first, since Loopback refers to it */
  212.     "None",         NULL,           NULL,           NULL,
  213.     NULL,           CL_NONE,        0,
  214.  
  215. #ifdef  AX25
  216.     "AX25",         ax_send,        ax_output,      pax25,
  217.     setcall,        CL_AX25,        AXALEN,
  218. #endif
  219.  
  220. #ifdef  SLIP
  221.     "SLIP",         slip_send,      NULL,           NULL,
  222.     NULL,           CL_NONE,        0,
  223. #endif
  224.  
  225. #ifdef  ETHER
  226.     /* Note: NULL is specified for the scan function even though
  227.      * gether() exists because the packet drivers don't support
  228.      * address setting.
  229.      */
  230.     "Ethernet",     enet_send,      enet_output,    pether,
  231.     NULL,           CL_ETHERNET,    EADDR_LEN,
  232. #endif
  233.  
  234. #ifdef  NETROM
  235.     "NETROM",       nr_send,        NULL,           pax25,
  236.     setcall,        CL_NETROM,      AXALEN,
  237. #endif
  238.  
  239. #ifdef  SLFP
  240.     "SLFP",         pk_send,        NULL,           NULL,
  241.     NULL,           CL_NONE,        0,
  242. #endif
  243.  
  244. #ifdef  PPP
  245.     "PPP",          ppp_send,       ppp_output,     NULL,
  246.     NULL,           CL_PPP, 0,
  247. #endif
  248.  
  249.     NULLCHAR
  250. };
  251.  
  252. /* Command lookup and branch tables */
  253. struct cmds DFAR Cmds[] = {
  254.     /* The "go" command must be first */
  255.     "",             go,             0, 0, NULLCHAR,
  256. #ifndef AMIGA
  257. #ifdef SHELL
  258.     "!",            doshell,        0, 0, NULLCHAR,
  259. #endif
  260. #endif
  261. #ifdef ALLSESSIONS
  262.     "abort",    doabort,    0, 0, NULLCHAR,
  263. #endif
  264. #ifdef  AMIGA
  265.     "amiga",        doamiga,        0, 0, NULLCHAR,
  266. #endif
  267. #if     (defined(MAC) && defined(APPLETALK))
  268.     "applestat",    doatstat,       0,      0, NULLCHAR,
  269. #endif
  270. #if     (defined(AX25) || defined(ETHER) || defined(APPLETALK))
  271.     "arp",          doarp,          0, 0, NULLCHAR,
  272. #endif
  273. #ifdef  ASY
  274. #ifdef UNIX
  275.     "asyconfig",    doasyconfig,    0, 2,
  276.         "asyconfig <iface> <parameter>",
  277. #endif
  278.     "asystat",      doasystat,      0, 0, NULLCHAR,
  279. #endif
  280. #ifdef ATCMD
  281.     "at",       doat,       0, 0, NULLCHAR,
  282. #endif
  283.     "attach",       doattach,       0, 2,
  284.         "attach <hardware> <hw specific options>",
  285.     "attended",     doattended,     0, 0, NULLCHAR,
  286. #ifdef  AX25
  287. #ifdef AUTOROUTE
  288.     "autoroute",doax25autoroute, 0, 0, NULLCHAR,
  289. #endif /* AUTOROUTE */
  290.     "ax25",     doax25,     0, 0, NULLCHAR,
  291. #endif /* AX25 */
  292. #ifdef  MAILBOX
  293.     "bbs",      dobbs,      1024, 0, NULLCHAR,
  294. #endif
  295. #ifdef  BOOTP
  296.     "bootp",    dobootp,    0, 0, NULLCHAR,
  297.     "bootpd",       bootpdcmd,      0, 0, NULLCHAR,
  298. #endif
  299. #ifdef RLINE
  300.     "bulletin", dombrline,  0, 0, NULLCHAR,
  301. #endif
  302. /* This one is out of alpabetical order to allow abbreviation to "c" */
  303. #ifdef  AX25
  304. #ifdef ALLSESSIONS
  305.     "connect",  doconnect,  1024, 3,
  306.     "connect <interface> <callsign>",
  307. #endif
  308. #endif
  309. #ifdef CALLBOOK
  310.     "callserver", doinetcallserver, 0, 0, NULLCHAR,
  311. #endif
  312. #ifdef CALLCLI
  313.   "callbook", docallbook, 1024, 2, "callbook CALLSIGN",
  314.   "callserver2", docallserver, 0, 0, NULLCHAR,
  315. #endif
  316. #if !defined(UNIX) && !defined(AMIGA)
  317. #ifdef ALLCMD
  318.     "cd",       docd,       0, 0, NULLCHAR,
  319. #endif
  320. #ifdef CALLSERVER
  321.   "cdrom", docdrom, 0, 0, NULLCHAR,
  322. #endif
  323. #endif
  324.     "close",        doclose,        0, 0, NULLCHAR,
  325.     "cls",  (int (*)__ARGS((int,char**,void*)))    clrscr,      0, 0, NULLCHAR,
  326. #ifdef ASY
  327.     "comm",     doasycomm,  0, 3,"comm <interface> <text-string>",
  328. #endif
  329. #ifdef CONVERS
  330.     "convers",  doconvers,  0,  0, NULLCHAR,
  331. #endif
  332. #ifdef ALLCMD
  333.     "copy",     docopy,     0, 3,"copy <file> <newfile>",
  334. #endif
  335. /* This one is out of alpabetical order to allow abbreviation to "d" */
  336. #ifdef ALLSESSIONS
  337.     "disconnect",   doclose,    0, 0, NULLCHAR,
  338. #endif
  339. #ifndef AMIGA
  340. #ifdef ALLCMD
  341.     "dir",      dodir,      0, 0, NULLCHAR, /* note sequence */
  342. #endif
  343. #endif
  344. #ifdef ALLCMD
  345.     "delete",   dodelete,   0, 2, "delete <file>",
  346. #endif
  347.     "detach",   dodetach,   0, 2, "detach <interface>",
  348. #ifdef  DIALER
  349.     "dialer",       dodialer,       512, 2,
  350.     "dialer <iface> [<file> [<seconds> [<pings> [<hostid>]]]]",
  351. #endif
  352.     "domain",       dodomain,       0, 0, NULLCHAR,
  353. #ifdef  DRSI
  354.     "drsistat",     dodrstat,       0, 0, NULLCHAR,
  355. #endif
  356. #ifdef ALLCMD
  357.     "dump",     domdump,    0, 0, NULLCHAR,
  358. #endif
  359.     "errors",   doerror,    0, 0, NULLCHAR,
  360. #ifdef  HS
  361.     "hs",           dohs,           0, 0, NULLCHAR,
  362. #endif
  363. #ifdef  EAGLE
  364.     "eaglestat",    doegstat,       0, 0, NULLCHAR,
  365. #endif
  366.     "echo",         doecho,         0, 0, NULLCHAR,
  367.     "eol",          doeol,          0, 0, NULLCHAR,
  368. #if     (!defined(MSDOS) || defined(ESCAPE))
  369.     "escape",       doescape,       0, 0, NULLCHAR,
  370. #endif
  371. #ifdef  PC_EC
  372.     "etherstat",    doetherstat,    0, 0, NULLCHAR,
  373. #endif
  374.     "exit",         doexit,         0, 0, NULLCHAR,
  375. #ifdef EXPIRY
  376.     "expire",   doexpire,   0, 0, NULLCHAR,
  377. #endif
  378. #ifdef ALLCMD
  379.     "finger",   dofinger,   1024, 2, "finger name@host",
  380. #ifdef MSDOS
  381.     "fkey",         dofkey,         0, 0, NULLCHAR,
  382. #endif
  383. #endif
  384. #ifdef ALLSESSIONS
  385.     "ftp",      doftp,      2048, 2, "ftp <address>",
  386.     "ftype",    doftype,    0, 0, NULLCHAR,
  387. #endif
  388. #ifdef FTPTDISC
  389.     "ftptdisc", doftptdisc, 0, 0, NULLCHAR,
  390. #endif
  391. #ifdef HAPN
  392.     "hapnstat",     dohapnstat,     0, 0, NULLCHAR,
  393. #endif
  394.     "help",         dohelp,         0, 0, NULLCHAR,
  395.     "history",  dohistory,  0, 0, NULLCHAR,
  396. #ifdef  HOPCHECK
  397.     "hop",          dohop,          0, 0, NULLCHAR,
  398. #endif
  399.     "hostname",     dohostname,     0, 0, NULLCHAR,
  400. #ifdef  HS
  401.     "hs",           dohs,           0, 0, NULLCHAR,
  402. #endif
  403.     "icmp",         doicmp,         0, 0, NULLCHAR,
  404.     "ifconfig",     doifconfig,     0, 0, NULLCHAR,
  405. #ifdef ALLCMD
  406.     "info",     doinfo,     0, 0, NULLCHAR,
  407. #endif
  408.     "ip",       doip,       0, 0, NULLCHAR,
  409. #ifdef  MSDOS
  410.     "isat",         doisat,         0, 0, NULLCHAR,
  411. #endif  
  412.     "kick",         dokick,         0, 0, NULLCHAR,
  413. #ifdef LOCK
  414.     "lock",     dolock,     0, 0, NULLCHAR,
  415. #endif
  416.     "log",      dolog,      0, 0, NULLCHAR,
  417. #ifdef LZW
  418.     "lzw",      dolzw,      0, 2, "lzw <mode|bits>",
  419. #endif
  420. #ifdef ALLCMD
  421. #ifndef UNIX
  422.     /* maybe I'll port a mailer for this.  I doubt it. */
  423.     "mail",     dobmail,    0, 0, NULLCHAR,
  424. #endif
  425. #endif
  426. #ifdef  MAILBOX
  427.     "mbox",         dombox,         0, 0, NULLCHAR,
  428. #endif
  429. #ifndef UNIX
  430.     "memory",       domem,          0, 0, NULLCHAR,
  431. #endif
  432. #ifdef ALLCMD
  433.     "mkdir",    domkd,      0, 2, "mkdir <directory>",
  434. #endif
  435. #ifdef  AX25
  436.     "mode",         domode,         0, 2, "mode <interface>",
  437. #endif
  438. #ifdef ALLCMD
  439.     "more",     domore,     0, 2, "more <file> [searchstring]",
  440.     "motd",         domotd,         0, 0, NULLCHAR,
  441. #endif
  442. #ifdef  MSDOS
  443. #ifdef MULTITASK
  444.     "multitask",    dobackg,    0, 0, NULLCHAR,
  445. #endif
  446. #endif
  447. #ifdef  NETROM
  448.     "netrom",       donetrom,       0, 0, NULLCHAR,
  449. #endif  /* NETROM */
  450. #if (defined(NNTP) || defined(NNTPS))
  451.     "nntp",         donntp,         0, 0, NULLCHAR,
  452. #endif
  453. #ifdef NRS
  454.     "nrstat",       donrstat,       0, 0, NULLCHAR,
  455. #endif
  456. #ifdef EXPIRY
  457.     "oldbid",   dooldbids,  0, 0, NULLCHAR,
  458. #endif
  459.     "param",        doparam,        0, 2, "param <interface>",
  460.     "ping",         doping,         512, 2,
  461.     "ping <hostid> [<length> [<interval> [incflag]]]",
  462. #ifdef  PI
  463.     "pistatus",     dopistat,       0, 0, NULLCHAR,
  464. #endif
  465. #ifdef  POP
  466.     "pop",          dopop,          0, 0, NULLCHAR,
  467. #endif
  468. #ifdef  MAILCLIENT
  469.     "popmail",      domsread,       0, 0, NULLCHAR,
  470. #endif
  471. #ifdef PPP
  472.     "ppp",          doppp_commands, 0, 0, NULLCHAR,
  473. #endif
  474.     "prompt",   doprompt,   0, 0, NULLCHAR,
  475.     "ps",           ps,             0, 0, NULLCHAR,
  476. #if     !defined(UNIX) && !defined(AMIGA)
  477. #ifdef ALLCMD
  478.     "pwd",      docd,       0, 0, NULLCHAR,
  479. #endif
  480. #endif
  481. #if     (defined(AX25) || defined(ETHER))
  482. #ifdef RARP
  483.     "rarp",     dorarp,     0, 0, NULLCHAR,
  484. #endif /* RARP */
  485. #endif
  486. #ifdef  RDATE
  487.     "rdate",    dordate,    0, 0, NULLCHAR,
  488. #endif
  489. #ifdef ALLCMD
  490.     "record",   dorecord,   0, 0, NULLCHAR,
  491. #endif
  492.     "remote",   doremote,   0, 3, "remote [-p port] [-k key] [-a kickaddr] <address> exit|reset|kick",
  493. #ifdef ALLCMD
  494.     "rename",   dorename,   0, 3, "rename <oldfile> <newfile>",
  495. #endif
  496.     "repeat",   dorepeat, 512, 3, "repeat <interval> <command> [args...]",
  497.     "reset",    doreset,    0, 0, NULLCHAR,
  498. #ifdef  RIP
  499.     "rip",          dorip,          0, 0, NULLCHAR,
  500. #endif
  501. #ifdef  RLOGINCLI
  502.     "rlogin",       dorlogin,       2048, 2, "rlogin <address>",
  503. #endif
  504. #ifdef ALLCMD
  505.     "rmdir",    dormd,      0, 2, "rmdir <directory>",
  506. #endif
  507.     "route",    doroute,    0, 0, NULLCHAR,
  508. #ifdef  RSPF
  509.     "rspf",         dorspf,         0, 0, NULLCHAR,
  510. #endif  /* RSPF */
  511.     "session",      dosession,      0, 0, NULLCHAR,
  512. #ifdef UNIX
  513.     "sessmgr",    dosessmgr,    0, 0, NULLCHAR,
  514. #endif
  515. #ifdef  SCC
  516.     "sccstat",      dosccstat,      0, 0, NULLCHAR,
  517. #endif
  518. #if     !defined(AMIGA)
  519. #ifdef SHELL
  520.     "shell",    doshell,    0, 0, NULLCHAR,
  521. #endif
  522. #endif
  523.     "skick",    dokicksocket,0,2, "skick <socket#>",
  524.     "smtp",     dosmtp,     0, 0, NULLCHAR,
  525.     "socket",       dosock,         0, 0, NULLCHAR,
  526.     "source",       dosource,       0, 2, "source <filename>",
  527. #ifdef  SERVERS
  528.     "start",        dostart,        0, 2, "start <servername>",
  529.     "stop",         dostop,         0, 2, "stop <servername>",
  530. #endif
  531.     "status",   dostatus,   0, 0, NULLCHAR,
  532. #ifdef  AX25
  533. #ifdef ALLSESSIONS
  534. #ifdef ALLSERV
  535.     "split",  doconnect,  1024, 3,
  536.     "split <interface> <callsign>",
  537. #endif
  538. #endif
  539. #endif
  540.     "tcp",      dotcp,      0, 0, NULLCHAR,
  541. #ifdef ALLCMD
  542.     "tail",     dotail,     0, 2, "tail <filename>",
  543. #endif
  544. #ifdef ALLSESSIONS
  545.     "telnet",   dotelnet,   1024, 2, "telnet <address> [port]",
  546. #endif
  547. #ifdef ALLSERV
  548.     "ttylink",  dotelnet,  1024, 2, "ttylink <address> [port]",
  549. #endif
  550. #ifdef  MAILBOX
  551.     "third-party",  dothirdparty,   0, 0, NULLCHAR,
  552. #endif
  553.     "tip",      dotip,      256, 2, "tip <iface (asyc only!)>",
  554. #ifdef  PACKETWIN
  555.     "tsync_stat",   do_tsync_stat,  0, 0, NULLCHAR,
  556.     "tsydump",              do_tsync_dump,  0, 2, "tsydump <channel>",
  557. #endif
  558. #ifdef  TRACE
  559.     "trace",        dotrace,        0, 0, NULLCHAR,
  560.     "strace",   dostrace,   0, 0, NULLCHAR,
  561. #endif
  562.     "udp",          doudp,          0, 0, NULLCHAR,
  563. #ifdef ALLCMD
  564.     "upload",   doupload,   0, 0, NULLCHAR,
  565. #endif
  566. #ifdef  MSDOS
  567. #ifdef ALLCMD
  568. #ifdef SWATCH
  569.     "watch",    doswatch,   0, 0, NULLCHAR,
  570. #endif
  571. #endif
  572.     "watchdog", dowatchdog, 0, 0, NULLCHAR,
  573. #endif
  574.     "write",    dowrite,    0, 3, "write <user|sock#> <msg>",
  575. #ifdef MAILBOX
  576.     "writeall", dowriteall, 0, 2, "writeall <msg>",
  577. #endif
  578.     "?",        dohelp,     0, 0, NULLCHAR,
  579.     NULLCHAR,       NULLFP((int,char**,void*)),         0, 0,
  580.         "Unknown command; type \"?\" for list",
  581. };
  582.  
  583. /* List of supported hardware devices */
  584. struct cmds Attab[] = {
  585. #ifdef  PC_EC
  586.     /* 3-Com Ethernet interface */
  587.     "3c500", ec_attach, 0, 7, 
  588.     "attach 3c500 <address> <vector> arpa <label> <buffers> <mtu> [ip_addr]",
  589. #endif
  590. #ifdef  ASY
  591.     /* Ordinary PC asynchronous adaptor */
  592.     "asy",  asy_attach, 0, 8, 
  593. #ifndef AMIGA
  594. #ifdef  NRS
  595. #ifdef  PPP
  596.     "attach asy <address> <vector> slip|ax25|nrs|ppp <label> <buffers> <mtu> <speed> [options]",
  597. #else   /* PPP */
  598.     "attach asy <address> <vector> slip|ax25|nrs <label> <buffers> <mtu> <speed> [options]",
  599. #endif  /* PPP */
  600. #else   /* NRS */
  601. #ifdef  PPP
  602.     "attach asy <address> <vector> slip|ax25|ppp <label> <buffers> <mtu> <speed> [options]",
  603. #else   /* PPP */
  604.     "attach asy <address> <vector> slip|ax25 <label> <buffers> <mtu> <speed> [options]",
  605. #endif  /* PPP */
  606. #endif  /* NRS */
  607. #else
  608. #ifdef  NRS
  609. #ifdef  PPP
  610.     "attach asy <driver> <unit> slip|ax25|nrs|ppp <label> <buffers> <mtu> <speed> [options]",
  611. #else   /* PPP */
  612.     "attach asy <driver> <unit> slip|ax25|nrs <label> <buffers> <mtu> <speed> [options]",
  613. #endif  /* PPP */
  614. #else   /* NRS */
  615. #ifdef  PPP
  616.     "attach asy <driver> <unit> slip|ax25|ppp <label> <buffers> <mtu> <speed> [options]",
  617. #else   /* PPP */
  618.     "attach asy <driver> <unit> slip|ax25 <label> <buffers> <mtu> <speed> [options]",
  619. #endif  /* PPP */
  620. #endif  /* NRS */
  621. #endif  /* AMIGA */
  622. #endif  /* ASY */
  623. #ifdef  KISS
  624.     /* Multi-port KISS interface piggy-backing on ASY interface. */
  625.     "kiss", kiss_attach, 0, 4, 
  626.     "attach kiss <asy_interface_label> <port> <label> [mtu]",
  627. #endif  /* KISS */
  628. #ifdef  PC100
  629.     /* PACCOMM PC-100 8530 HDLC adaptor */
  630.     "pc100", pc_attach, 0, 8, 
  631.     "attach pc100 <address> <vector> ax25 <label> <buffers>\
  632.  <mtu> <speed> [ip_addra] [ip_addrb]",
  633. #endif
  634. #ifdef  DRSI
  635.     /* DRSI PCPA card in low speed mode */
  636.     "drsi", dr_attach, 0, 8,
  637.     "attach drsi <address> <vector> ax25 <label> <bufsize> <mtu>\
  638. <chan a speed> <chan b speed> [ip addr a] [ip addr b]",
  639. #endif
  640. #ifdef  EAGLE
  641.     /* EAGLE RS-232C 8530 HDLC adaptor */
  642.     "eagle", eg_attach, 0, 8,
  643.     "attach eagle <address> <vector> ax25 <label> <buffers>\
  644.  <mtu> <speed> [ip_addra] [ip_addrb]",
  645. #endif
  646. #ifdef  HAPN
  647.     /* Hamilton Area Packet Radio (HAPN) 8273 HDLC adaptor */
  648.     "hapn", hapn_attach, 0, 8,
  649.     "attach hapn <address> <vector> ax25 <label> <rx bufsize>\
  650.  <mtu> csma|full [ip_addr]",
  651. #endif
  652. #ifdef  APPLETALK
  653.     /* Macintosh AppleTalk */
  654.     "0", at_attach, 0, 7,
  655.     "attach 0 <protocol type> <device> arpa <label> <rx bufsize> <mtu> [ip_addr]",
  656. #endif
  657. #ifdef NETROM
  658.     /* fake netrom interface */
  659.     "netrom", nr_attach, 0, 1,
  660.     "attach netrom [ip_addr]",
  661. #endif
  662. #ifdef  PACKET
  663.     /* FTP Software's packet driver spec */
  664.     "packet", pk_attach, 0, 4,
  665.     "attach packet <int#> <label> <buffers> <mtu> [ip_addr]",
  666. #endif
  667. #ifdef  HS
  668.     /* Special high speed driver for DRSI PCPA or Eagle cards */
  669.     "hs", hs_attach, 0, 7,
  670.     "attach hs <address> <vector> ax25 <label> <buffers> <mtu>\
  671.  <txdelay> <persistence> [ip_addra] [ip_addrb]",
  672. #endif
  673. #ifdef  PI
  674.     /* Special high speed driver for PI 8530 HDLC adapter */
  675.     "pi", pi_attach, 0, 8,
  676.     "attach pi <address> <vector> <dmachannel> ax25 <label> <buffers>\
  677.     <mtu> <speed a> <speed b> [ip_addra] [ip_addrb]",
  678. #endif
  679. #ifdef SCC
  680.     "scc", scc_attach, 0, 7,
  681.     "attach scc <devices> init <addr> <spacing> <Aoff> <Boff> <Dataoff>\n"
  682.     "   <intack> <vec> [p]<clock> [hdwe] [param]\n"
  683.     "attach scc <chan> slip|kiss|nrs|ax25 <label> <mtu> <speed> <bufsize> [call] ",
  684. #endif
  685. #ifdef  PACKETWIN
  686.     /* Gracilis PackeTwin */
  687.     "tsync", tsync_attach, 0, 11,
  688.     "attach tsync <chan> <vec> <iobase> <hdx|fdx> <dma|ints> <rxdmachan> <name> <rxsize> <txsize> <speed> [txclk] [rxclk] [nrz|nrzi] [ipaddr] [#rxbufs]",
  689. #endif
  690. #ifdef AXIP
  691.     "axip",axip_attach, 0, 4,
  692.     "attach axip <name> <mtu> <remote-hostid> [callsign]",
  693. #endif
  694.     NULLCHAR,
  695. };
  696.  
  697. #ifndef UNIX
  698.  
  699. /* Functions to be called on each clock tick */
  700. void (*Cfunc[]) __ARGS((void)) = {
  701.     pctick, /* Call PC-specific stuff to keep time */
  702.     kbint,  /* Necessary because there's no hardware keyboard interrupt */
  703.     refiq,  /* Replenish interrupt pool */
  704. #ifdef  ASY
  705.     asytimer,
  706. #endif
  707. #ifdef  SCC
  708.     scctimer,
  709. #endif
  710.     NULL,
  711. };
  712.  
  713. /* Entry points for garbage collection */
  714. void (*Gcollect[]) __ARGS((int)) = {
  715.     tcp_garbage,
  716.     ip_garbage,
  717.     udp_garbage,
  718.     st_garbage,
  719. #ifdef  AX25
  720.     lapb_garbage,
  721. #endif
  722. #ifdef  NETROM
  723.     nr_garbage,
  724. #endif
  725.     NULL
  726. };
  727.  
  728. /* Functions to be called at shutdown */
  729. void (*Shutdown[])() = {
  730. #ifdef SCC
  731.     sccstop,
  732. #endif
  733.     uchtimer,       /* Unlink timer handler from timer chain */
  734.     NULLVFP,
  735. };
  736.  
  737. #endif
  738.  
  739. /* Packet tracing stuff */
  740. #ifdef  TRACE
  741. #include "trace.h"
  742.  
  743. #ifdef MONITOR
  744. #define NULLMONFP NULLVFP((FILE *,struct mbuf **, int, int))
  745. #else
  746. #define NULLMONFP NULLVFP((FILE *,struct mbuf **, int))
  747. #endif
  748.  
  749. /* Protocol tracing function pointers. Matches list of class definitions
  750.  * in pktdrvr.h.
  751.  */
  752. struct trace Tracef[] = {
  753.     NULLFP((struct iface*,struct mbuf*)), ip_dump,        /* CL_NONE */
  754.  
  755. #ifdef  ETHER                           /* CL_ETHERNET */
  756.     ether_forus,    ether_dump,
  757. #else
  758.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,
  759. #endif  /* ETHER */
  760.  
  761.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,    /* CL_PRONET_10 */
  762.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,    /* CL_IEEE8025 */
  763.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,    /* CL_OMNINET */
  764.  
  765. #ifdef  APPLETALK
  766.     at_forus,       at_dump,        /* CL_APPLETALK */
  767. #else
  768.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,
  769. #endif  /* APPLETALK */
  770.  
  771. #ifdef VJCOMPRESS
  772.     NULLFP((struct iface*,struct mbuf*)), sl_dump,     /* CL_SERIAL_LINE */
  773. #else
  774.     NULLFP((struct iface*,struct mbuf*)), ip_dump,     /* CL_SERIAL_LINE */
  775. #endif
  776.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,   /* CL_STARLAN */
  777.  
  778. #ifdef  ARCNET
  779.     arc_forus,      arc_dump,       /* CL_ARCNET */
  780. #else
  781.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,
  782. #endif  /* ARCNET */
  783.  
  784. #ifdef  AX25
  785.     ax_forus,       ax25_dump,      /* CL_AX25 */
  786. #else
  787.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,
  788. #endif  /* AX25 */
  789.  
  790. #ifdef  KISS                            /* CL_KISS */
  791.     ki_forus,       ki_dump,
  792. #else
  793.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,
  794. #endif  /* KISS */
  795.  
  796.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,  /* CL_IEEE8023 */
  797.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,  /* CL_FDDI */
  798.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,  /* CL_INTERNET_X25 */
  799.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,  /* CL_LANSTAR */
  800. #ifdef  SLFP
  801.     NULLFP((struct iface*,struct mbuf*)), ip_dump,        /* CL_SLFP */
  802. #else
  803.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,
  804. #endif  /* SLFP */
  805.  
  806. #ifdef  NETROM                          /* CL_NETROM */
  807.     NULLFP((struct iface*,struct mbuf*)), ip_dump,
  808. #else
  809.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,
  810. #endif
  811.  
  812. #ifdef PPP
  813.     NULLFP((struct iface*,struct mbuf*)), ppp_dump,       /* CL_PPP */
  814. #else
  815.     NULLFP((struct iface*,struct mbuf*)), NULLMONFP,
  816. #endif /* PPP */
  817. };
  818.  
  819. #else
  820.  
  821. /* Stub for packet dump function */
  822. void
  823. #ifdef PROTOTYPES
  824. dump(struct iface *iface,int direction,unsigned type,struct mbuf *bp)
  825. #else
  826. dump(iface,direction,type,bp)
  827. struct iface *iface;
  828. int direction;
  829. unsigned type;
  830. struct mbuf *bp;
  831. #endif
  832. {
  833. }
  834. void
  835. #ifdef PROTOTYPES
  836. raw_dump(struct iface *iface,int direction,struct mbuf *bp)
  837. #else
  838. raw_dump(iface,direction,bp)
  839. struct iface *iface;
  840. int direction;
  841. struct mbuf *bp;
  842. #endif
  843. {
  844. }
  845.  
  846. #endif  /* TRACE */
  847.  
  848.  
  849. #ifdef  AX25
  850. #ifdef AUTOROUTE
  851. /* G4JEC's automatic ARP & Route resolution code primitive. */
  852. extern void ax25eavesdrop(struct iface * iface,
  853.                 char *source, char * dest,
  854.                 struct mbuf * bp);
  855.  
  856. extern int Ax25_autoroute;
  857. #endif /* AUTOROUTE */
  858.  
  859. /* Hooks for passing incoming AX.25 data frames to network protocols */
  860. void
  861. axip(iface,axp,src,dest,bp,mcast)
  862. struct iface *iface;
  863. struct ax25_cb *axp;
  864. char *src;
  865. char *dest;
  866. struct mbuf *bp;
  867. int mcast;
  868. {
  869. #ifdef AUTOROUTE
  870.     struct mbuf *nbp;
  871.  
  872.     if(Ax25_autoroute) {
  873.     dup_p(&nbp, bp, 0, len_p(bp));
  874.     (void) ax25eavesdrop(iface,src,dest,nbp);
  875.     free_p(nbp);
  876.     }
  877. #endif
  878.     (void)ip_route(iface,bp,mcast);
  879. }
  880.  
  881. static void
  882. axarp(iface,axp,src,dest,bp,mcast)
  883. struct iface *iface;
  884. struct ax25_cb *axp;
  885. char *src;
  886. char *dest;
  887. struct mbuf *bp;
  888. int mcast;
  889. {
  890.     (void)arp_input(iface,bp);
  891. }
  892.  
  893. #ifdef RARP
  894. static void
  895. axrarp(iface,axp,src,dest,bp,mcast)
  896. struct iface *iface;
  897. struct ax25_cb *axp;
  898. char *src;
  899. char *dest;
  900. struct mbuf *bp;
  901. int mcast;
  902. {
  903.     (void)rarp_input(iface,bp);
  904. }
  905. #endif /* RARP */
  906.  
  907. #ifdef  NETROM
  908. static void
  909. axnr(iface,axp,src,dest,bp,mcast)
  910. struct iface *iface;
  911. struct ax25_cb *axp;
  912. char *src;
  913. char *dest;
  914. struct mbuf *bp;
  915. int mcast;
  916. {
  917.     if(!mcast)
  918.         nr_route(bp,axp);
  919.     else
  920.         nr_nodercv(iface,src,bp);
  921. }
  922.  
  923. #endif  /* NETROM */
  924. #endif  /* AX25 */
  925.  
  926. #ifndef RIP
  927. /* Stub for routing timeout when RIP is not configured -- just remove entry */
  928. void
  929. rt_timeout(s)
  930. void *s;
  931. {
  932.     struct route *stale = (struct route *)s;
  933.  
  934.     rt_drop(stale->target,stale->bits);
  935. }
  936. #endif
  937.  
  938. #ifdef  SERVERS
  939. /* "start" and "stop" subcommands */
  940. static struct cmds DFAR Startcmds[] = {
  941. #if     defined(AX25) && defined(MAILBOX)
  942.     "ax25",         ax25start,      256, 0, NULLCHAR,
  943. #endif
  944. #ifdef CALLSERVER
  945.     "callbook",     cdbstart,       256, 0, NULLCHAR,
  946. #endif
  947. #ifdef  CONVERS
  948.     "convers",      conv1,          384, 0, NULLCHAR,
  949. #endif
  950. #ifdef ALLSERV
  951.     "discard",  dis1,       256, 0, NULLCHAR,
  952.     "echo",         echo1,          256, 0, NULLCHAR,
  953. #endif
  954.     "finger",   finstart,   256, 0, NULLCHAR,
  955.     "ftp",          ftpstart,       256, 0, NULLCHAR,
  956. #if   defined(MBFWD) && defined(MAILBOX)
  957.     "forward",  fwdstart,   2048, 0, NULLCHAR,
  958. #endif
  959. #if defined(NETROM) && defined(MAILBOX)
  960.     "netrom",       nr4start,       256, 0, NULLCHAR,
  961. #endif
  962. #ifdef  NNTPS
  963.     "nntp",     nntp1,      256, 0, NULLCHAR,
  964. #endif
  965. #ifdef  POP
  966.     "pop",          pop1,           256, 0, NULLCHAR,
  967. #endif
  968. #ifdef  POP2SERVER
  969.     "pop2",         pop2start,      2048,0, NULLCHAR,
  970. #endif
  971. #ifdef  POP3SERVER
  972.     "pop3",         pop3start,      2048,0, NULLCHAR,
  973. #endif
  974. #ifdef  RIP
  975.     "rip",          doripinit,      0,   0, NULLCHAR,
  976. #endif
  977.     "smtp",         smtp1,          512, 0, NULLCHAR,
  978. #ifdef MAILBOX
  979.     "telnet",       telnet1,        256, 0, NULLCHAR,
  980. #ifdef ALLSERV
  981. #ifdef TIPMAIL
  982.     "tip",      tipstart,   256, 2, "start tip <interface>",
  983. #endif /* TIPMAIL */
  984. #endif /* ALLSERV */
  985. #endif /* MAILBOX */
  986. #ifdef  RDATE
  987.     "time",     time1,      256, 0, NULLCHAR,
  988. #endif
  989. #ifdef ALLSERV
  990.     "ttylink",  ttylstart,  512, 0, NULLCHAR,
  991. #endif
  992.     "remote",   rem1,       768, 0, NULLCHAR,
  993.     NULLCHAR,
  994. };
  995. static struct cmds DFAR Stopcmds[] = {
  996. #if     defined(AX25) && defined(MAILBOX)
  997.     "ax25",         ax250,          0, 0, NULLCHAR,
  998. #endif
  999. #ifdef CALLSERVER
  1000.     "callbook",     cdb0,           0, 0, NULLCHAR,
  1001. #endif
  1002. #ifdef  CONVERS
  1003.     "convers",  conv0,      384, 0, NULLCHAR,
  1004. #endif
  1005. #ifdef ALLSERV
  1006.     "discard",  dis0,       0, 0, NULLCHAR,
  1007.     "echo",         echo0,          0, 0, NULLCHAR,
  1008. #endif
  1009.     "finger",   fin0,       0, 0, NULLCHAR,
  1010.     "ftp",          ftp0,           0, 0, NULLCHAR,
  1011. #if   defined(MBFWD) && defined(MAILBOX)
  1012.     "forward",  fwd0,       0, 0, NULLCHAR,
  1013. #endif
  1014. #if defined(NETROM) && defined(MAILBOX)
  1015.     "netrom",       nr40,           0, 0, NULLCHAR,
  1016. #endif
  1017. #ifdef  NNTPS
  1018.     "nntp",     nntp0,      0, 0, NULLCHAR,
  1019. #endif
  1020. #ifdef  POP
  1021.     "pop",          pop0,           0, 0, NULLCHAR,
  1022. #endif
  1023. #ifdef  POP2SERVER
  1024.     "pop2",         pop2stop,      2048,0, NULLCHAR,
  1025. #endif
  1026. #ifdef  POP3SERVER
  1027.     "pop3",         pop3stop,      2048,0, NULLCHAR,
  1028. #endif
  1029. #ifdef  RIP
  1030.     "rip",          doripstop,      0, 0, NULLCHAR,
  1031. #endif
  1032.     "smtp",         smtp0,          0, 0, NULLCHAR,
  1033. #ifdef  MAILBOX
  1034.     "telnet",       telnet0,        0, 0, NULLCHAR,
  1035. #ifdef ALLSERV
  1036. #ifdef TIPMAIL
  1037.     "tip",      tip0,       0, 2, "stop tip <interface>",
  1038. #endif
  1039. #endif
  1040. #endif
  1041. #ifdef  RDATE
  1042.     "time",     time0,      0, 0, NULLCHAR,
  1043. #endif
  1044. #ifdef ALLSERV
  1045.     "ttylink",  ttyl0,      0, 0, NULLCHAR,
  1046. #endif
  1047.     "remote",   rem0,       0, 0, NULLCHAR,
  1048.     NULLCHAR,
  1049.  
  1050. };
  1051. static int
  1052. dostart(argc,argv,p)
  1053. int argc;
  1054. char *argv[];
  1055. void *p;
  1056. {
  1057.     int insave,outsave;
  1058.  
  1059.     insave = Curproc->input;
  1060.     outsave = Curproc->output;
  1061.     Curproc->input = Cmdpp->input;
  1062.     Curproc->output = Cmdpp->output;
  1063.  
  1064.     subcmd(Startcmds,argc,argv,p);
  1065.  
  1066.     Curproc->input = insave;
  1067.     Curproc->output = outsave;
  1068.     return 0;
  1069. }
  1070.  
  1071. static int
  1072. dostop(argc,argv,p)
  1073. int argc;
  1074. char *argv[];
  1075. void *p;
  1076. {
  1077.     return subcmd(Stopcmds,argc,argv,p);
  1078. }
  1079. #endif  /* SERVERS */
  1080.  
  1081. /* Various configuration-dependent functions */
  1082.  
  1083. /* put mbuf into Hopper for network task
  1084.  * returns 0 if OK
  1085.  */
  1086. int
  1087. net_route(ifp, type, bp)
  1088. struct iface *ifp;
  1089. int type;
  1090. struct mbuf *bp;
  1091. {
  1092.     struct mbuf *nbp;
  1093.     struct phdr phdr;
  1094.  
  1095.     phdr.iface = ifp;
  1096.     phdr.type = type;
  1097.  
  1098.     if ((nbp = pushdown(bp,sizeof(phdr))) == NULLBUF ){
  1099.         return -1;
  1100.     }
  1101.     memcpy( &nbp->data[0],(char *)&phdr,sizeof(phdr));
  1102.     enqueue(&Hopper,nbp);
  1103.     /* Especially on slow machines, serial I/O can be quite
  1104.      * compute intensive, so release the machine before we
  1105.      * do the next packet.  This will allow this packet to
  1106.      * go on toward its ultimate destination. [Karn]
  1107.      */
  1108.     pwait(NULL);
  1109.     return 0;
  1110. }
  1111.  
  1112. /* Process packets in the Hopper */
  1113. static void
  1114. network(i,v1,v2)
  1115. int i;
  1116. void *v1;
  1117. void *v2;
  1118. {
  1119.     struct mbuf *bp;
  1120.     struct phdr phdr;
  1121.     int i_state;
  1122.  
  1123. loop:
  1124. #ifndef UNIX
  1125.     refiq();        /* Replenish interrupt buffer pool */
  1126. #endif
  1127.  
  1128.     i_state = dirps();
  1129.     while(Hopper == NULLBUF)
  1130.         pwait(&Hopper);
  1131.  
  1132.     /* this is silly, first we turn ints on, then off again...? -WG7J */
  1133.     /* Process the input packet */
  1134.     /*
  1135.     bp = dequeue(&Hopper);
  1136.      */
  1137.  
  1138.     bp = Hopper;
  1139.     Hopper = Hopper->anext;
  1140.     bp->anext = NULLBUF;
  1141.     restore(i_state);
  1142.  
  1143.     pullup(&bp,(char *)&phdr,sizeof(phdr));
  1144.     if(phdr.iface != NULLIF){
  1145.         phdr.iface->rawrecvcnt++;
  1146.         phdr.iface->lastrecv = secclock();
  1147.     }
  1148. #ifdef TRACE
  1149.     dump(phdr.iface,IF_TRACE_IN,(unsigned)phdr.type,bp);
  1150. #endif
  1151.     switch(phdr.type){
  1152. #ifdef  KISS
  1153.     case CL_KISS:
  1154.         kiss_recv(phdr.iface,bp);
  1155.         break;
  1156. #endif
  1157. #ifdef  AX25
  1158.     case CL_AX25:
  1159.         ax_recv(phdr.iface,bp);
  1160.         break;
  1161. #endif
  1162. #ifdef  ETHER
  1163.     case CL_ETHERNET:
  1164.         eproc(phdr.iface,bp);
  1165.         break;
  1166. #endif
  1167. #ifdef ARCNET
  1168.     case CL_ARCNET:
  1169.         aproc(phdr.iface,bp);
  1170.         break;
  1171. #endif
  1172. #ifdef PPP
  1173.     case CL_PPP:
  1174.         ppp_proc(phdr.iface,bp);
  1175.         break;
  1176. #endif
  1177.     /* These types have no link layer protocol at the point when they're
  1178.      * put in the hopper, so they can be handed directly to IP. The
  1179.      * separate types are just for user convenience when running the
  1180.      * "iface" command.
  1181.      */
  1182.     case CL_NONE:
  1183.     case CL_SERIAL_LINE:
  1184.     case CL_SLFP:
  1185.         ip_route(phdr.iface,bp,0);
  1186.         break;
  1187.     default:
  1188.         free_p(bp);
  1189.         break;
  1190.     }
  1191.     /* Let everything else run - this keeps the system from wedging
  1192.      * when we're hit by a big burst of packets
  1193.      */
  1194.     pwait(NULL);
  1195.     goto loop;
  1196. }
  1197.